package com.example.mathtest;

import android.content.Intent;

import android.os.Bundle;

import android.view.MenuItem;
import android.view.View;

import android.widget.Button;



import androidx.appcompat.widget.Toolbar;

public class MainActivity extends BaseActivity {
    Toolbar toolbar_main ;
    Button start_button;
    Button error_button;
    Button love_button;
    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        toolbar_main = findViewById(R.id.toolbar_main);
        toolbar_main.inflateMenu(R.menu.actionbar_menu);
        start_button = findViewById(R.id.learnBtn);
        error_button = findViewById(R.id.ErrorBtn);
        love_button = findViewById(R.id.LoveBtn);


        setStatusBarColorToLOLLIPOP(MainActivity.this,R.color.colorApp);

        //跳转到答题页面
        start_button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this,SelectActivity.class);
                startActivity(intent);
            }
        });

        //跳转到错题本页面
        error_button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this,ErrorQuestionActivity.class);
                startActivity(intent);
            }
        });

        //跳转到收藏夹页面
        love_button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this,LoveQuestionActivity.class);
                startActivity(intent);
            }
        });

        //跳转到个人中心
        toolbar_main.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                if (item.getItemId() == R.id.action_settings){
                    Intent intent = new Intent(MainActivity.this,UserActivity.class);
                    startActivity(intent);
                }
                return false;
            }
        });

    }


}
